 <?php
if (!isset($modulus)) {
	$modulus = 12;
}
if (!isset($model)) {
	
        $ar = array_keys($this->params['paging']);
        $model = $ar[0];
}
if($this->params['paging'][$model]['count']>$this->params['paging'][$model]['limit'])
{
?>
<div class="clearfix">

	 <ul class="pagination">
		<?php echo $this->Paginator->first('<i class="fa fa-chevron-left"></i><i class="fa fa-chevron-left"></i>', array('title' => 'Go to First Page','tag' => 'li','escape' => false),array('escape' => false)); ?>
		<?php echo $this->Paginator->prev('<i class="fa fa-chevron-left"></i>', array('title' => 'Go to Previous Page','class' => 'prev','tag' => 'li','escape' => false), '<a onclick="return false;"><i class="fa fa-chevron-left"></i></a>', array('class' => 'prev disabled','tag' => 'li','escape' => false)); ?>
		<?php
		$page = $this->params['paging'][$model]['page'];
		$pageCount = $this->params['paging'][$model]['pageCount'];
		if ($modulus > $pageCount) {
			$modulus = $pageCount;
		}
		$start = $page - intval($modulus / 2);
		if ($start < 1) {
			$start = 1;
		}
		$end = $start + $modulus;
		if ($end > $pageCount) {
			$end = $pageCount + 1;
			$start = $end - $modulus;
		}
		for ($i = $start; $i < $end; $i++) {
			$url = array('page' => $i);
			$class = null;
			if ($i == $page) {
				$url = array();
				$class = 'active';
			}
			echo $this->Html->tag('li', $this->Paginator->link($i, $url), array(
				'class' => $class,
				'title' => 'Go to Page '.$i,
			));
		}
		?>
		<?php echo $this->Paginator->next('<i class="fa fa-chevron-right"></i>', array('title' => 'Go to Next Page','class' => 'next','tag' => 'li','escape' => false), '<a onclick="return false;"><i class="fa fa-chevron-right"></i></a>', array('class' => 'next disabled','tag' => 'li','escape' => false)); ?>
		<?php echo str_replace('<>', '', $this->Html->tag('li', $this->Paginator->last('<i class="fa fa-chevron-right"></i><i class="fa fa-chevron-right"></i>', array(
			'tag' => null,'escape' => false
		)), array(
			'class' => 'next',
			'title' => 'Go to Last page',
		))); ?>
        
        <?php //echo $this->Paginator->last('>>>', array('tag' => 'li')); ?>
	</ul>
</div>  <?php //echo $this->Paginator->last('ggggggggggggggggg', array('tag' => 'li')); ?>
<?php }
if($this->params['paging'][$model]['count']<1)
echo '<div role="alert" class="alert alert-warning">
        <strong>Alert !</strong> Record not found.
      </div>';
 ?>